C++17 in Detail by Bartłomiej Filipek

C++17 in Detail by Bartłomiej Filipek

Author:Bartłomiej Filipek [Bartłomiej Filipek]
Language: eng
Format: epub, pdf
Publisher: leanpub.com
Published: 2018-08-10T00:00:00+00:00


See the full header file in boost/doc/libs/1_67_0/boost/utility/string_view.hpp And in Boost utility library

The link to the discussion about deprecation of string_ref: “string_view versus string_ref”.

Examples

Below you can find two examples of using string_view.

Working with Different String APIs

An interesting use case for string_view is when you use it in code that works with different string implementations.

For example, you might have CString from MFC, const char* from C-APIs, QString from QT, and of course std::string.

Rather than creating overloads for different string types, you might leverage string_view!

For example:

void Process(std::string_view sv) { }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.